#ifndef INPUTWINDOW_H
#define INPUTWINDOW_H

#include <QMainWindow>
#include <QDateEdit>
#include <QLineEdit>
#include <QPushButton>
#include <QComboBox>

#include <QString>
#include <QVector>

class InputWindow : public QMainWindow
{
    Q_OBJECT
public:
    explicit InputWindow(const QString &username, QWidget *parent = nullptr);
    void showHistory();

signals:
    void dataSubmitted(double height, double weight, int age, const QString &gender, const QDate &date);

private:
    QString username;
    QLineEdit *heightInput;
    QLineEdit *weightInput;
    QLineEdit *ageInput;
    QComboBox *genderInput;
    QPushButton *calculateBtn;
    QPushButton *historyBtn;
    QDateEdit *dateInput;
    
    struct Record {
        QString date;
        double height;
        double weight;
        int age;
        QString gender;
        double bmi;
    };
    
    QVector<Record> records;
    void saveRecord(double height, double weight, int age, const QString &gender, const QDate &date, double bmi);
    void loadRecords();
};

#endif // INPUTWINDOW_H